<?php $username = $_GET['username']?>

<div class="span3">
	<?php if($node->parent_id !=0){
		$root_page = Node::model()->findByPk($node->parent_id);
	}else{
		$root_page = $node;
	}
		$sub_pages =  Node::model()->findAll("parent_id = $root_page->id");
		$navs = array(array('label'=>$root_page->title,'itemOptions'=>array("class"=>'nav-header')));
		foreach ($sub_pages as $sub_page){
			array_push($navs,array('label'=>$sub_page->title,'url'=>array("node/view","username"=>$username,"id"=>$sub_page->id)));
		}
	?>
	
	<?php 
	 	Utils::displayBtn(CHtml::link('<i class="icon-plus icon-white"></i> 创建子页面 ',array("node/add","username"=>$username,'parent_id'=>$root_page->id,'type'=>Node::TYPE_PAGE),array("class"=>'btn btn-primary btn-large')));
	?>
		<br/><br/>
	<div class="well sidebar-nav">
	<?php 
		$this->widget('zii.widgets.CMenu', array(
            'items'=>$navs,
			'htmlOptions'=>array("class"=>'nav nav-list'),
	));?>
	</div>
	<!--/.well -->
</div>

<div class="span9">
			<div class='div div-plain'>
	<?php if($node->type == Node::TYPE_NEWS):?>
		<h2 class='div'>
			<?php echo $node->title;?>
		</h2>
	<?php endif;?>
	
	
		<div>
			<?php echo $node->content;?>
			
			<div class="btn-group">
			
				<?php
					Utils::displayBtn(CHtml::link('<i class="icon-edit icon-black"></i> 编辑', array("node/add","id"=>$node->id,'username'=>$node->member->username),array("class"=>'btn')));
					Utils::displayBtn(CHtml::link('<i class="icon-remove-sign icon-black"></i> 删除', array("node/delete","id"=>$node->id,'username'=>$node->member->username),array("class"=>'btn','onclick'=>'return confirm("确定要删除吗？")')));
				?>
			</div>
	
		</div>
	</div>
</div>
<!--/span-->


<!--/span-->